<template>
  <el-row>
    <el-col :span="4">
      <el-card>
        <div style="font-size: 50px">{{ indexPrice1 }}</div>
        <div v-if="indexChange1>0" style="font-size: 30px; color:red">+{{ indexChange1 }}%</div>
        <div v-else style="font-size: 30px; color:green">-{{ Math.abs(indexChange1) }}%</div>
        <div style="font-size: 30px ">上证指数</div>
      </el-card>
    </el-col>
    <el-col :span="1"></el-col>
    <el-col :span="4">
      <el-card>
        <div style="font-size: 50px">{{ indexPrice2 }}</div>
        <div v-if="indexChange2>0" style="font-size: 30px; color:red">+{{ indexChange2 }}%</div>
        <div v-else style="font-size: 30px; color:green">-{{ Math.abs(indexChange2) }}%</div>
        <div style="font-size: 30px ">深证成指</div>
      </el-card>
    </el-col>
    <el-col :span="1"></el-col>
    <el-col :span="4">
      <el-card>
        <div style="font-size: 50px">{{ indexPrice3 }}</div>
        <div v-if="indexChange3>0" style="font-size: 30px; color:red">+{{ indexChange3 }}%</div>
        <div v-else style="font-size: 30px; color:green">-{{ Math.abs(indexChange3) }}%</div>
        <div style="font-size: 30px ">创业板指</div>
      </el-card>
    </el-col>
    <el-col :span="1"></el-col>
    <el-col :span="4">
      <el-card @click="toTrade">
        <div style="font-size: 50px">{{ stockPrice }}</div>
        <div v-if="stockChange>0" style="font-size: 30px; color:red">+{{ stockChange }}%</div>
        <div v-else style="font-size: 30px; color:green">-{{ Math.abs(stockChange) }}%</div>
        <div style="font-size: 30px ">{{ stockName }}</div>
      </el-card>
    </el-col>
    <el-col :span="1"></el-col>
    <el-col :span="3">
      <el-input v-model="formattedStockCode" @keyup.enter="clickSearch"></el-input>
    </el-col>
    <el-col :span="1">
      <el-button icon="el-icon-search" @click="clickSearch"/>
    </el-col>
  </el-row>
  <StockCandle v-bind:stockCode="stockCode" v-bind:stockName="stockName"></StockCandle>
  <StockRank @changeStock="changeStock"></StockRank>
</template>

<script lang="js" src="./Stock.js"></script>

<style scoped>

</style>
